package com.qunar.train.mock.sedis;

import com.qunar.redis.storage.AdvancedSedis;
import com.qunar.redis.storage.Sedis;

public class MockAdvancedSedis extends AdvancedSedis {

    public static String VERSION = "1.0.0";

    public static ThreadLocal<MockAdvancedSedis> threadLocal = new ThreadLocal<>();

    public static MockAdvancedSedis getInstance() {
        if (threadLocal.get() == null) {
            threadLocal.set(new MockAdvancedSedis());
        }
        return threadLocal.get();
    }

    private String msetReturnValue = null;
    private String msetReturnValuePString = null;
    private String toStringReturnValue = null;
    private int getSocketTimeoutReturnValue = 0;
    private int hashCodeReturnValue = 0;
    private java.util.Map<String, String> mgetReturnValuePIntString = null;
    private java.util.Map<byte[], byte[]> mgetReturnValuePByte = null;
    private boolean equalsReturnValue = false;
    private java.util.Map<byte[], byte[]> mgetReturnValue = null;
    private java.util.Map<String, String> mgetReturnValuePString = null;

    public MockAdvancedSedis() {
        super(new Sedis("", ""));
    }

    public void mexpireAt(long arg0, byte[][] arg1) {
    }

    public String mset(byte[][] arg0) {
        return getInstance().msetReturnValue;
    }

    public void mexpire(int arg0, String[] arg1) {
    }

    public String mset(String[] arg0) {
        return getInstance().msetReturnValuePString;
    }

    public String toString() {
        return getInstance().toStringReturnValue;
    }

    public int getSocketTimeout() {
        return getInstance().getSocketTimeoutReturnValue;
    }

    public void mexpire(int arg0, byte[][] arg1) {
    }

    public void mexpireAt(long arg0, String[] arg1) {
    }

    public int hashCode() {
        return getInstance().hashCodeReturnValue;
    }

    public java.util.Map<String, String> mget(int arg0, String[] arg1) {
        return getInstance().mgetReturnValuePIntString;
    }

    public java.util.Map<byte[], byte[]> mget(byte[][] arg0) {
        return getInstance().mgetReturnValuePByte;
    }

    public boolean equals(Object arg0) {
        return getInstance().equalsReturnValue;
    }

    public java.util.Map<byte[], byte[]> mget(int arg0, byte[][] arg1) {
        return getInstance().mgetReturnValue;
    }

    public java.util.Map<String, String> mget(String[] arg0) {
        return getInstance().mgetReturnValuePString;
    }


    public static void setMsetReturnValue(String p) {
        getInstance().msetReturnValue = p;
    }

    public static void setMsetReturnValuePString(String p) {
        getInstance().msetReturnValuePString = p;
    }

    public static void setToStringReturnValue(String p) {
        getInstance().toStringReturnValue = p;
    }

    public static void setGetSocketTimeoutReturnValue(int p) {
        getInstance().getSocketTimeoutReturnValue = p;
    }

    public static void setHashCodeReturnValue(int p) {
        getInstance().hashCodeReturnValue = p;
    }

    public static void setMgetReturnValuePIntString(java.util.Map<String, String> p) {
        getInstance().mgetReturnValuePIntString = p;
    }

    public static void setMgetReturnValuePByte(java.util.Map<byte[], byte[]> p) {
        getInstance().mgetReturnValuePByte = p;
    }

    public static void setEqualsReturnValue(boolean p) {
        getInstance().equalsReturnValue = p;
    }

    public static void setMgetReturnValue(java.util.Map<byte[], byte[]> p) {
        getInstance().mgetReturnValue = p;
    }

    public static void setMgetReturnValuePString(java.util.Map<String, String> p) {
        getInstance().mgetReturnValuePString = p;
    }

    public static void clear() {
        getInstance().msetReturnValue = null;
        getInstance().msetReturnValuePString = null;
        getInstance().toStringReturnValue = null;
        getInstance().getSocketTimeoutReturnValue = 0;
        getInstance().hashCodeReturnValue = 0;
        getInstance().mgetReturnValuePIntString = null;
        getInstance().mgetReturnValuePByte = null;
        getInstance().equalsReturnValue = false;
        getInstance().mgetReturnValue = null;
        getInstance().mgetReturnValuePString = null;
    }
}
